package com.monitoramento.controller;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.monitoramento.entity.Telemetria;
import com.monitoramento.service.ArduinoService;
import com.monitoramento.service.ArduinoServiceImpl;

@ManagedBean(name = "telemetriaController")
@ViewScoped
public class TelemetriaController implements Serializable {

	private static final long serialVersionUID = 5453841504759782745L;
	
	private Telemetria telemetria;
	
	ArduinoService arduinoService;
	
	public TelemetriaController(){
		
		telemetria = new Telemetria();
		arduinoService = new ArduinoServiceImpl();
//		this.telemetria = arduinoService.getValoresSensores();
	}
		
	public void atualizarSensores(){
		
		arduinoService = new ArduinoServiceImpl();
		this.telemetria = arduinoService.getValoresSensores();
		
	}
	
	public void iniciaContagemArduino() {
		
		arduinoService.iniciaCronometro();
		
	}	
	
	public void getTempoTotalDeProva(){
		
		arduinoService.getTempoTotalDeProva();
		
	}

	public Telemetria getTelemetria() {
		return telemetria;
	}

	public void setTelemetria(Telemetria telemetria) {
		this.telemetria = telemetria;
	}

}
